<template>
  <div class="page-container" style="min-width: 1170px;">
    <ex_super_form id="page_order_create" ref="form" v-bind="formOption" v-loading="loading"
      class="common-form-row common-form-panel-div-right" label-position="right" label-width="140px">



    </ex_super_form>
  </div>
</template>

<script>
let default_obj = {

}
import router_params from '@/mixin/router_params';
export default {
  title: 'label_abnormal_detail',
  mixins: [router_params],
  data() {
    return {
      loading: false,

      formOption: {

        model: [
          { header: "label_base_info", },
          {
            grid: [
              [
                {
                  key: "customerName", label: "label_customer", formType: 'text',
                  formatter: (r, c, v, i) => this.$formatNameCode(v, r.customerCode)
                },
                {
                  key: "anomalyOccurrenceDate", label: "label_abnormal_happen_time", formType: 'text',
                  formatter: (r, c, v, i) => this.$dateFormat(v)
                },
              ],
              [
                {
                  key: "orderType", label: "label_order_type", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalOrderTypeEnum")

                },
                {
                  key: "orderNo", label: "label_order_code", formType: 'text',
                },
              ],
              [
                {
                  key: "businessOrderType", label: "label_business_order_type", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalBusinessOrderTypeEnum")

                },
                {
                  key: "businessOrderNo", label: "label_business_order_code", formType: 'text',
                },
              ],
              [
                {
                  key: "status", label: "异常状态", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalStatusEnum")
                },
                {
                  key: "anomalyCause", label: "label_reason_abnormal", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AnomalyCauseEnum")
                },
              ],
              [
                {
                  key: "anomalyClassifyName", label: "label_anomaly_class", formType: 'text',
                },

                {
                  key: "anomalyDescribeName", label: "label_anomaly_desc", formType: 'text',
                },

              ],
              [
                { key: 'anomalyBoxQty', label: 'label_abnormal_box_count', formType: 'text', },
                { key: 'anomalySkuQty', label: 'label_abnormal_piece_count', formType: 'text', },
              ],
              [
                {
                  key: 'warehouseName', label: 'label_abnormal_generation_warehouse', formType: 'text',
                  formatter: (r, c, v, i) => this.$formatNameCode(v, r.warehouseCode)
                },
                { key: 'anomalyRemark', label: 'label_abnormal_remark', formType: 'text', },

              ],
              [
                {
                  key: "anomalySourceSystem", label: "label_generation_system", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalSourceSystemEnum")
                },
                {
                  key: "anomalySourceMode", label: "label_generation_method", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalSourceModeEnum")
                },
              ],
              [
                {
                  key: "isSyncCustomer", label: "同步客户端", formType: 'text',
                  formatter: (r, c, v, i) => this.$enumShow(v, "YesOrNoEnum")
                },
                { key: 'anomalyRestartCause', label: '异常重启原因', formType: 'text', },

              ],
              [
                {
                  key: 'reportUserName', label: 'label_report_user', formType: 'text',
                  formatter: (r, c, v, i) => this.$formatNameCode(v, r.reportUserCode)
                },
                {
                  key: 'reportTime', label: 'label_report_time', formType: 'text',
                  formatter: (r, c, v, i) => this.$dateFormat(v)
                },
              ],
              [
                {
                  key: 'acceptUserName', label: 'label_accept_user', formType: 'text',
                  formatter: (r, c, v, i) => this.$formatNameCode(v, r.acceptUserCode)
                },
                {
                  key: 'acceptTime', label: 'label_accept_time', formType: 'text',
                  formatter: (r, c, v, i) => this.$dateFormat(v)
                },
              ],
              [
                { key: 'anomalySkuValue', label: 'label_abnormal_sku_value', formType: 'text', },

                {
                  key: 'attachedList', label: 'label_abnormal_attachment', type: 'upload-file',
                  render: (h, { data }) => {
                    return h('ex-upload-file', {
                      props: {
                        limit: 3,
                        disabled: true,
                        readonly: true,
                        value: data.attachedList
                      },
                    },)
                  }
                },
              ],
            ]
          },



         
          { header: "label_abnormal_specification", },
          {
            key: 'detailList',

            formType: "table",
            itemAttrs: {
              'label-width': '0',
            },
            attrs: {
              height: 300,
            },
            model: [
              { key: 'skuOnlyCode', label: 'label_sku_only_code', 'min-width': 150, 'show-overflow-tooltip': true, },
              { key: 'skuBarcode', label: 'label_sku_code', 'min-width': 150, 'show-overflow-tooltip': true, },
              { key: 'skuName', label: 'label_sku_name', 'width': 130, 'show-overflow-tooltip': true, },
              { key: 'abnormalQty', label: 'label_abnormal_count', 'width': 110, 'show-overflow-tooltip': true, },
              {
                key: 'currencyCode', label: 'label_declaration_currency', 'width': 110, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "CurrencyTypeEnum")
              },
              { key: 'anomalySkuValue', label: '异常商品总价值', 'width': 110, 'show-overflow-tooltip': true, },
            ],

          },
          { header: "label_check_feedback_record", },

          {
            key: 'checkRecordList',
            formType: "table",
            itemAttrs: {
              'label-width': '0',
            },
            attrs: {
              height: 300,
            },
            model: [
              {
                key: 'checkResponsibleParty', label: 'label_check_determine_responsible', 'min-width': 150, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalResponsiblePartyEnum")
              },
              { key: 'checkRemark', label: 'label_check_remarck', 'min-width': 150, 'show-overflow-tooltip': true, },
              {
                key: 'checkTime', label: 'label_check_time', 'width': 130, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$dateFormat(v)
              },
              {
                key: 'checkUserName', label: 'label_check_user', 'width': 110, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$formatNameCode(v, r.checkUserCode)
              },
            ],
          },
          { header: "label_check_handler_record", },

          {
            key: 'disposeRecordList',
            formType: "table",
            itemAttrs: {
              'label-width': '0',
            },
            attrs: {
              height: 300,
            },
            model: [
              {
                key: 'disposeResponsibleParty', label: 'label_handler_determine_responsible', 'min-width': 150, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalResponsiblePartyEnum")
              },
              {
                key: 'disposeMode', label: 'label_do_with_method', 'min-width': 180, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalDisposeModeEnum")
              },
              {
                key: 'disposeBoxQty', label: 'label_handler_box_count', 'width': 130, 'show-overflow-tooltip': true,
              },
              {
                key: 'disposeSkuQty', label: 'label_handler_piece_count', 'width': 130, 'show-overflow-tooltip': true,
              },
              {
                key: 'isCompensation', label: 'label_is_compensation', 'width': 130, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "YesOrNoEnum")
              },
              {
                key: 'compensationAmount', label: 'label_compensation_money', 'width': 130, 'show-overflow-tooltip': true,
              },
              {
                key: 'disposeTime', label: 'label_handler_time', 'width': 130, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$dateFormat(v)
              },
              {
                key: 'disposeUserName', label: 'label_handler_user', 'width': 110, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$formatNameCode(v, r.disposeUserCode)
              },
            ],

          },
          { header: "label_anomaly_operate_record", },

          {
            key: 'operatingRecordList',
            formType: "table",
            itemAttrs: {
              'label-width': '0',
            },
            attrs: {
              height: 300,
            },
            model: [
              {
                key: "sourceSystem", label: "系统",
                formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalSourceSystemEnum")
              },
              {
                key: 'operatingNode', label: 'label_abnormal_opeate_node', 'min-width': 150, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$enumShow(v, "AbnormalOperatingNodeEnum")
              },
              {
                key: 'userName', label: 'label_operate_user', 'width': 110, 'show-overflow-tooltip': true,
                formatter: (r, c, v, i) => this.$formatNameCode(v, r.userCode)
              },
              { key: 'gmtCreate', label: 'label_operate_time', width: 140, formatter: (r, c, v, i) => this.$dateFormatTime(v) },
            ],

          },
        ],
      }
    }
  },

  methods: {
    fixTabLabel(code) {
      this.$emit("tagModifyLabel", { _key: 'label_name_code', name: this.$tt('label_abnormal_detail'), code: code || "" })

    },
    init_order(id) {
      this.loading = true
      let data = {
        id
      }
      this.$ajax({
        url: this.$url['oms/BaseAnomalyDetail'],
        method: 'post',
        data,
        success: (res) => {
          if (!res.data) return this.$message.error(this.$tt("label_data_loss"))
          this.$refs.form.setData(res.data)
          this.loading = false
          this.fixTabLabel(res.data.code)
        },
      })
    },
    init_data_default(params) {
      this.init_order(params.id)
    },
  }
}
</script>

<style scoped></style>
